// 全局工具函数的封装
import Vue from "vue"
import router from "../router"
import store from "../store"

export default {
    mustBeLogin() {
        console.log("调用了mustBeLogin方法");
        let token = localStorage.getItem("token");
        if (!token) {
            Vue.prototype.$toast("请先登录!");
            setTimeout(() => {
                // console.log(store);
                // console.log(store["_mutations"]["isGoBack/changeisGoBack"][0](true));
                console.log(store["_mutations"]["isGoBack/changeisGoBack"][0](true));
                store["_mutations"]["isGoBack/changeisGoBack"][0](true)
                router.push("/user");
            }, 1000);
            return false;
        }
        return true
    }
}